Skip to content

feat: adding stewardship tables and small fixis (CM-1218)#4191

Open
ulemons wants to merge 3 commits into
mainfrom
feat/stewardship-tables
Open

feat: adding stewardship tables and small fixis (CM-1218)#4191
ulemons wants to merge 3 commits into
mainfrom
feat/stewardship-tables

Conversation

@ulemons

@ulemons ulemons commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Provisions the six stewardship tables for the OSSPREY Self Serve program (v1) and cleans up the packages API type layer. In v1 only stewardships is populated — one unassigned row per critical package via the import job. The other five tables are schema-only, empty until v2 write flows land.

Changes

  • Migration V1781094067__stewardship-tables.sql: creates stewardships, stewardship_stewards, stewardship_activity, stewardship_assessments, stewardship_findings, stewardship_remediation_actions with all indexes and FK constraints. Notable deviations from the original spec: updated_at added to stewardship_assessments (was missing vs all other mutable tables); optional assessment_id FK on stewardship_findings to link findings to the assessment that produced them when v2 lands
  • types.ts (new): single source of truth for domain types — StewardshipStatus, Lifecycle, SeverityLevel, OpenVulns, Steward, StewardshipSummary — previously scattered as inline literals across handler files
  • OpenAPI: added stewardship block to PackageDetail; renamed PackageListItem.stewardstewards; added openVulns to StewardshipSummary.required
  • batchGetStewardship.ts: reads stewardship.status from mock detail instead of hardcoding 'unassigned'; removed redundant in guard on severity accumulator
  • mockData.ts: all types now reference types.ts; stewardship block added to MockPackageDetail

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

JIRA ticket

ticket


Note

Medium Risk
New production migration on packages FKs affects core OSS package data; public API contract changes (stewardstewards, new detail shape) may break consumers until coordinated.

Overview
Adds OSSPREY stewardship persistence via migration V1781094067__stewardship-tables.sql: six related tables (stewardships plus stewards, activity, assessments, findings, remediation actions) with FKs and indexes; v1 is expected to populate only stewardships (one unassigned row per critical package).

Packages public API is aligned ahead of real DB reads: new shared types.ts centralizes stewardship/lifecycle/vuln types; mocks gain a stewardship block and list items use stewards (array) instead of steward. batchGetStewardship now returns status/stewards from mock detail (not hardcoded unassigned) and simplifies open-vuln counting. listPackages unstewardedOnly treats both null and unassigned as unstewarded. OpenAPI documents PackageDetail.stewardship, plural stewards, and adds openVulns to required StewardshipSummary fields.

Reviewed by Cursor Bugbot for commit f1421c2. Bugbot is set up for automated code reviews on this repo. Configure here.

@ulemons ulemons self-assigned this Jun 10, 2026
Copilot AI review requested due to automatic review settings June 10, 2026 14:15
ulemons added 2 commits June 10, 2026 16:17
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons force-pushed the feat/stewardship-tables branch from 3555909 to b7f1724 Compare June 10, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR provisions the initial database schema for OSSPREY Self Serve “stewardship” (v1) and refactors the public Packages API typing + OpenAPI spec to introduce a stewardship surface area (currently backed by mocks).

Changes:

  • Add a new packages-db migration creating six stewardship-related tables with indexes/FKs.
  • Introduce a single types.ts source-of-truth for stewardship/domain types and update mocks/handlers to use it.
  • Update the Packages OpenAPI schema to include stewardship fields and adjust the list/batch shapes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/src/osspckgs/migrations/V1781094067__stewardship-tables.sql Adds stewardship tables + indexes for v1/v2 rollout.
backend/src/api/public/v1/packages/types.ts Adds centralized TS domain types for packages stewardship API.
backend/src/api/public/v1/packages/openapi.yaml Extends public OpenAPI contract with stewardship fields and tweaks required fields.
backend/src/api/public/v1/packages/mockData.ts Updates mocks to use shared types and adds stewardship to detail mocks.
backend/src/api/public/v1/packages/batchGetStewardship.ts Aligns batch endpoint output with new types and mock detail stewardship status.
Comments suppressed due to low confidence (1)

backend/src/api/public/v1/packages/openapi.yaml:201

  • stewards is named as a plural but is modeled as a single Steward (or null), and the description also says “Single assigned steward”. This is inconsistent for API consumers and future evolution (especially since the DB schema is many-to-many). Either rename the field to singular (steward) everywhere, or change the shape to an array (stewards: Steward[]) and update the OpenAPI schema + handlers/mocks accordingly.
        stewards:
          description: Single assigned steward or null.
          oneOf:
            - $ref: '#/components/schemas/Steward'
            - type: 'null'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +38
openVulns: OpenVulns | null
stewardship: StewardshipStatus
stewards: Steward | null
lastActivityAt: string | null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulemons apply this fix

Comment on lines +415 to +426
stewardship:
type: object
description: Stewardship state. In v1 always unassigned with no stewards or activity.
properties:
status:
$ref: '#/components/schemas/StewardshipStatus'
stewards:
description: Single assigned steward or null. Null in v1.
oneOf:
- $ref: '#/components/schemas/Steward'
- type: 'null'
lastActivityAt:
joanagmaia
joanagmaia previously approved these changes Jun 11, 2026
Comment on lines +35 to +38
openVulns: OpenVulns | null
stewardship: StewardshipStatus
stewards: Steward | null
lastActivityAt: string | null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulemons apply this fix

… filter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 11, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment on lines 136 to 137
stewardship:
$ref: '#/components/schemas/StewardshipStatus'
Comment on lines 197 to 198
stewardship:
$ref: '#/components/schemas/StewardshipStatus'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants